package jmine.tec.script.impl.beanshell;

import java.io.BufferedReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import jmine.tec.script.persistent.driver.HeaderExtractor;

/**
 * Parser de cabeçalho de scripts beanshell.
 * 
 * @author lundberg
 */
public class BeanshellHeaderExtractor implements HeaderExtractor {

    /**
     * {@inheritDoc}
     */
    public List<String> readLines(BufferedReader reader) throws IOException {
        List<String> lines = new ArrayList<String>();
        String line;
        do {
            line = reader.readLine();
        } while (line != null && !line.contains("/**"));
        line = reader.readLine();
        while (line != null && !line.contains("*/")) {
            lines.add(line.substring(line.indexOf('*') + 1));
            line = reader.readLine();
        }
        return lines;
    }

}
